<template>
	
		<!-- <view>点我</view> -->
		
	<view v-if="detriment[0]!='fail'&&detriment[3]==1" class="empty">
					
						<form @submit="formSubmit" @reset="formReset">

						    <view class="uni-form-item uni-column">
						        <view class="title">添加图书</view>
						        <input class="uni-input" v-model="goods.title" name="input" placeholder="请输入标题" />
								<view class="divider"/>
								<input class="uni-input" v-model="goods.stock_quantity" name="input" placeholder="请输入数量" />
								<view class="divider"/>
								<input class="uni-input" v-model="goods.market_price" name="input" placeholder="请输入市场价" />
								<view class="divider"/>
								<input class="uni-input" v-model="goods.sell_price" name="input" placeholder="请输入二手价" />
						    </view>
						    <view class="uni-btn-v">
						        <button form-type="submit" style="background-color:  #F06C7A;">提交</button>
						        <button  type="default" form-type="reset">重置</button>
						    </view>
						</form>
					<!-- </view> -->
	</view>
	<view v-else class="empty-tips">
						<view class="navigator" >
							先去注册商家
						</view>
	</view>
	
	
	
</template>

<script>
	export default { 
		props:['detriment'],
		components:{
			 // orginPrice,
		},
		data() {
			return {
				goods:{
					title:'',
					stock_quantity:'',
					market_price:'',
					sell_price:'',
				}
			}
		},
		methods: {
		    async formSubmit() {
		        const res = await this.$myRequest({
		        			url: '/insertBook?title='+this.goods.title+'&stock_quantity='+this.goods.stock_quantity+'&market_price='+this.goods.market_price+'&sell_price='+this.goods.sell_price
		        			})
		        			console.log(res)
							this.goods.title=''
							this.goods.stock_quantity=''
							this.goods.market_price=''
							this.goods.sell_price=''
		        			
		        uni.showModal({
		            content: '提交成功',
		            showCancel: false
		        });
		    },
		    formReset: function(e) {
		        console.log('清空数据')
		    }
		}
		
		}
		

</script>

<style>
/* 整体内容 */
.index{
	margin-top:0upx;
	/* padding-top: -300upx; */
	width:100%;
}
/* 内容 */
.detriment{
	margin-bottom:20upx;
	box-sizing: border-box;
	position: relative;
}
/* 图片 */
.left{
	margin-left:50upx;
	display: inline-block;

}
.left image{
	width: 250upx;
	height: 250upx;
	margin: 0 auto;
	
}
/* 右侧介绍 */
.message{
	display: inline-block;
	/* padding-bottom: -100upx; */
	margin-left: 40upx;
	position: absolute;
	/* margin-top: -20upx; */
	float: left;
	
}


.empty-tips{
	font-size: 30upx;
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 300upx;
}

	.uni-form-item .title {
		text-align: center;
	    padding: 20rpx 0;
		font-size: 30upx;
		color:  #F06C7A;
	}
	.uni-input-input, .uni-input-placeholder {
	    width: 60%;
	}
	.uni-form-item .uni-input{
		margin-top: 35upx;
		margin-left: 40%;
	}
	.uni-btn-v button{
		/* margin-top: 35upx; */
		width: 30%;
	}
	.uni-btn-v{
		margin-left: 25%;
		margin-top: 35upx;
		display: flex;
		
	}
	uni-button {
		margin-left: 40upx;
	    position: relative;
	    display: block;
	    box-sizing: border-box;
	    font-size: 18px;
	    text-align: center;
	    text-decoration: none;
	    line-height: 2.55555556;
	    border-radius: 5px;
	    -webkit-tap-highlight-color: transparent;
	    overflow: hidden;
	    color: #000;
	    background-color: #f8f8f8;
	    cursor: pointer;
	}
</style>
